/*
 * fo2Pdf.java
 *
 * Created on 9 de septiembre de 2007, 11:14 AM
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package reporteTablero;

import java.io.FileOutputStream;
import java.io.OutputStream;
import org.apache.fop.apps.Driver;
import org.xml.sax.InputSource;
import org.apache.avalon.framework.logger.ConsoleLogger;
import org.apache.avalon.framework.logger.Logger;

/**
 *
 * @author Billy
 */
public class fo2Pdf {
    
    /** Creates a new instance of fo2Pdf */
    public fo2Pdf() {
    }
    
   public static void crearPdf(){
      try{
    InputSource foFile = new InputSource("reporteAjedrez.fo");    
    OutputStream out = new FileOutputStream("reporteAjedrez.pdf");

    Logger log = new ConsoleLogger(ConsoleLogger.LEVEL_WARN);
    Driver driver = new Driver(foFile, out);            
    driver.setLogger(log);    
    driver.setRenderer(Driver.RENDER_PDF);
    driver.run();           
    out.flush();
    out.close();
      }
    catch(Exception e){
	System.out.println(e);
    }
  }
    
}
